# 自定义异常
class MyException(Exception):
    def __init__(self, name, code):
        self.name = name
        self.code = code


try:
    raise MyException("自定义异常", 1001)
except MyException as e:
    print(e.name, e.code, type(e))
